package utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedpreferencesUtils {



    private volatile static SharedpreferencesUtils mSharedpreferencesUtils;
    private SharedpreferencesUtils() {
    }
    public static SharedpreferencesUtils getCheckSendDataUtilsInstance() {
        if (mSharedpreferencesUtils == null) {
            synchronized (SharedpreferencesUtils.class) {
                if (mSharedpreferencesUtils == null) {
                    mSharedpreferencesUtils = new SharedpreferencesUtils();
                }
            }
        }

        return mSharedpreferencesUtils;
    }
    /**
     * 保存蓝牙地址
     * @param valus
     */
    public  void saveBluetoothAddress(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("bluettothAddress",valus);
        editor.commit();
    }
    /**
     * 获取蓝牙地址
     */
    public  String getBluetoothAddress(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String bluetoothAddress=mSharedPreferences.getString("bluettothAddress","");
        return bluetoothAddress;
    }

    /**
     * 保存卡路里数据
     * @param valus
     */
    public  void saveCalories(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("calories",valus);
        editor.commit();
    }
    /**
     * 保存卡路里数据
     * @param
     */
    public  String getCalories(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String calories=mSharedPreferences.getString("calories","0");
        return calories;
    }


    /**
     * 保存步数数据
     * @param valus
     */
    public  void saveMovement(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("movement",valus);
        editor.commit();

    }
    /**
     * 保存步数数据
     * @param
     */
    public  String getMovement(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String movement=mSharedPreferences.getString("movement","0");
        return movement;
    }

    /**
     * 保存站立数据
     * @param valus
     */
    public  void saveStanding(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("standing",valus);
        editor.commit();

    }
    /**
     * 保存站立数据
     * @param
     */
    public  String getStanding(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("standing","0");
        return standing;
    }


    /**
     * 保存体重数据
     * @param valus
     */
    public  void saveWeight(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("weight",valus);
        editor.commit();

    }
    /**
     * 保存体重数据
     * @param
     */
    public  String getWeight(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("weight","0");
        return standing;
    }


    /**
     * 保存bmi数据
     * @param valus
     */
    public  void saveBMI(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("bmi",valus);
        editor.commit();

    }
    /**
     * 保存bmi数据
     * @param
     */
    public  String getBMI(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("bmi","0");
        return standing;
    }

    /**
     * 保存bmi数据
     * @param valus
     */
    public  void saveOpenAppCount(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("appCounts",valus);
        editor.commit();

    }
    /**
     * 保存bmi数据
     * @param
     */
    public  String getOpenAppCount(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("appCounts","0");
        return standing;
    }
    /**
     * 保存抬腕亮屏数据
     */

    public  void saveRaiseToWake(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("raiseToWake",valus);
        editor.commit();

    }
    /**
     * 获取抬腕亮屏数据
     */
    public  String getRaiseToWake(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("raiseToWake","0");
        return standing;
    }

    /**
     * 保存亮屏时长数据
     */

    public  void saveScreenTimeout(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("screenTimeout",valus);
        editor.commit();

    }
    /**
     * 获取亮屏时长数据
     */
    public  String getScreenTimeout(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("screenTimeout","60");
        return standing;
    }
    /**
     * 保存单位
     */

    public  void saveUnits(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("units",valus);
        editor.commit();

    }
    /**
     * 获取单位
     */
    public  String getUnits(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("units","0");
        return standing;
    }
    /**
     * 保存语言
     */

    public  void saveLanguage(String valus,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("language",valus);
        editor.commit();

    }
    /**
     * 获取语言
     */
    public  String getLanguage(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("language","1");
        return standing;
    }


    /**
     * 保存用户名和密码
     */

    public  void saveUserAndPassword(String user,String password,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("user",user);
        editor.putString("password",password);
        editor.commit();

    }
    /**
     * 获取用户名
     */
    public  String getUser(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("user","");
        return standing;
    }
    /**
     * 获取密码
     */
    public  String getPassword(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String standing=mSharedPreferences.getString("password","");
        return standing;
    }


    /**
     * 保存性别
     */
    public void saveSex(String sex,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("sex",sex);
        editor.commit();

    }

    /**
     * 获取性别
     */
    public  String getSex(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String sex=mSharedPreferences.getString("sex","");
        return sex;
    }

    /**
     * 保存身高
     */
    public void saveHeight(String height,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("height",height);
        editor.commit();

    }

    /**
     * 获身高
     */
    public  String getHeight(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String height=mSharedPreferences.getString("height","");
        return height;
    }
    /**
     * 保存点击healthy界面的次数
     */
    public void saveClickHealthyCounts(String clickHealthyCounts,Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor=mSharedPreferences.edit();
        editor.putString("clickHealthyCounts",clickHealthyCounts);
        editor.commit();

    }

    /**
     * 获身高
     */
    public  String getClickHealthyCounts(Context mContext){
        SharedPreferences   mSharedPreferences=  mContext.getSharedPreferences("health",Context.MODE_PRIVATE);
        String clickHealthyCounts=mSharedPreferences.getString("clickHealthyCounts","0");
        return clickHealthyCounts;
    }






}
